{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">管理日志</div>
    <div class="layui-card-body">
        <table class="layui-hide" id="currentTable" lay-filter="currentTable"></table>
    </div>
</div>
<script type="text/html" id="action">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" data-href="{:url('delete')}"><i class="layui-icon layui-icon-delete"></i></a>
</script>
{/block}
{block name="script"}
<script>
    layui.use('yznTable', function() {
        var table = layui.yznTable;

        var init = {
            table_elem: '#currentTable',
            del_url: "{:url('deletelog')}",
        };

        table.render({
            id: 'currentTable',
            elem: '#currentTable',
            toolbar: ['refresh',
                [{
                    text: '删除一个月前日志',
                    url: init.del_url,
                    method: 'request',
                    auth: 'refresh',
                    icon: 'layui-icon layui-icon-delete',
                    class: 'layui-btn layui-btn-sm layui-btn-danger',
                    extend: 'data-table="currentTable"',
                }]
            ],
            url: '{:url("index")}',
            cols: [
                [
                    {checkbox: true, fixed: 'left'},
                    {field: 'id', title: 'ID', width: 80, sort: true, search: false, align:"center"},
                    {field: 'admin_id', title: '管理ID', width: 100, sort: true, align:"center"},
                    {field: 'username', title: '账号', width: 100, sort: true,align:"center"},
                    {field: 'log_url', title: '地址', width: 300, templet: '#size', sort: true,},
                    {field: 'log_content', title: '内容',  sort: true,},
                    {field: 'log_title', title: '标题', width: 150, sort: true,},
                    {field: 'log_agent', title: '浏览器', width: 150, sort: true,},
                    {field: 'log_ip', title: 'ip', width: 150,align:"center"},
                    {field: 'create_time', title: '时间', width: 180, search: 'range',align:"center"},
                    {fixed: 'right', title:'操作',width:100, toolbar: '#action',align:"center"}
                ]
            ],
            page: {}
        });
    });
</script>
{/block}